package router

import (
	"github.com/gin-gonic/gin"
	"password-verification-management-system/controller"
	"password-verification-management-system/middleware"
)

func Start() {
	e := gin.Default()
	//e.Use(middleware.Cors())
	e.LoadHTMLGlob("templates/*")
	e.NoRoute(controller.Go404)
	e.Static("/assets", "./assets")
	api := e.Group("v1")
	{
		api.Use(middleware.AuthMiddleware())
		api.POST("/registeruser", controller.CreateUserByAdmin)
	}
	e.GET("/login", controller.GoLogin)
	//e.POST("/testto", controller.Testgetstr)
	e.POST("/login", controller.LoginAdmin)
	e.GET("/register", controller.GoRegister)
	e.POST("/register", controller.RegisterAdmin)
	e.POST("/getcode", controller.GetCodeAdmin)
	e.POST("/registeruser", controller.CreateUserByAdmin)
	e.GET("/", controller.GoIndex)
	e.Run()
}
